import { http } from "@/utils/http";
export interface QueryTwoCorrelationFactorSRes {
  /*相关因子X */
  listFactorX: Record<string, unknown>[];

  /*相关因子Y */
  listFactorY: Record<string, unknown>[];
}

/**
 * 查询二维度相关因子集合
 * @param {object} params TimeDTO
 * @param {object} params.startTime startTime
 * @param {object} params.endTime endTime
 * @returns
 */
export function queryTwoCorrelationFactorS(data): Promise<QueryTwoCorrelationFactorSRes> {
  return http.post(`/operation/api/v1/machine/correlationFactors/queryTwoCorrelationFactorS`, { data });
}

export interface QueryTwoCorrelationFactorSAndResultRes {
  /*factorB */
  factorB: string;

  /*result */
  result: number;
}

/**
 * 查询相关因子及其对应结果
 * @param {object} params QueryTwoCorrelationDTO
 * @param {array} params.factorA factorA
 * @param {array} params.factorB factorB
 * @returns
 */
export function queryTwoCorrelationFactorSAndResult(data): Promise<QueryTwoCorrelationFactorSAndResultRes> {
  return http.post(`/operation/api/v1/machine/correlationFactors/queryTwoCorrelationFactorSAndResult`, { data });
}
export interface QueryCellResultRes {
  /*result */
  result: {
    /*平均值 */
    avg: number;

    /*最大值 */
    max: number;

    /*最小值 */
    min: number;
  };
}

/**
 * 查询Cell位置其对应结果
 * @param {object} params QueryTwoCorrelationDTO
 * @param {object} params.startTime startTime
 * @param {object} params.endTime endTime
 * @param {array} params.factorA factorX
 * @param {array} params.factorB factorY
 * @returns
 */
export function queryCellResult(data): Promise<QueryCellResultRes> {
  return http.post(`/operation/api/v1/machine/correlationFactors/queryCellResult`, { data });
}
export interface QueryCommonCellResultRes {
  /*result */
  result: {
    /*平均值 */
    avg: number;

    /*最大值 */
    max: number;

    /*最小值 */
    min: number;
  };
}

/**
 * 查询CommonCell位置其对应结果
 * @param {object} params QueryCorrelationDTO
 * @param {array} params.factorList 因子集合
 * @returns
 */
export function queryCommonCellResult(data): Promise<QueryCommonCellResultRes> {
  return http.post(`/operation/api/v1/machine/correlationFactors/queryCommonCellResult`, { data });
}
